package Controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import Communication.Client;
import Controller.WorkerMainMenuController.WorkerMainMenuListener;
import View.HandleCatalogView;
import View.WorkerMainMenuView;

public class HandleCatalogController {

	private HandleCatalogView HandleCatalogView;
	private Client client;
	private int currentWorker;

	public HandleCatalogController(Client client, WorkerMainMenuController WorkerMainMenuController) {
		this.client = client;
		HandleCatalogView = new HandleCatalogView();
		HandleCatalogView.showWindow();
		HandleCatalogView.addHandleCatalogListener(new HandleCatalogListener(WorkerMainMenuController));
	}

	public void showWindow() {
			HandleCatalogView.showWindow();
		}

	/**
	 *  Hides worker Handle Catalog window
	 */
	public void hideWindow() {
		HandleCatalogView.hideWindow();
	}


	class HandleCatalogListener implements ActionListener 
	{
		LoginController loginController;
		SettingDistributionsController  SettingDistributionsController;



		public HandleCatalogListener(WorkerMainMenuController WorkerMainMenuController) {
			this.SettingDistributionsController = SettingDistributionsController;


		}
		@Override
		public void actionPerformed(ActionEvent event) {

			if (event.getSource() == HandleCatalogView.getbtnUpdate()) 
			{

				//	addNewCustomerController = new AddNewCustomerController(
					//	client, WorkerMainMenuController.this);
					
			}

			else if (event.getSource() == HandleCatalogView.getbtnAdd()) {
			//	newProductToCatalogController = new NewProductToCatalogController(
				//		client, WorkerMainMenuController.this);
			}
			else if (event.getSource() == HandleCatalogView.getbtnSet()) {
//				SettingDistributionsController = new SettingDistributionsController(
	//					client, HandleCatalogController.this);
				}


	}
	}
	/**
	 * @param availableButtons setup the available Button
	 */
	public void setActiveButtons(boolean[] availableButtons) {

		if (availableButtons[0] == false)
			HandleCatalogView.getbtnUpdate().setEnabled(false);

		if (availableButtons[1] == false)
			HandleCatalogView.getbtnAdd().setEnabled(false);

		if (availableButtons[2] == false)
			HandleCatalogView.getbtnSet().setEnabled(false);

	}


	/**
	 * 
	 */
	public void enableAll() {
		HandleCatalogView.getbtnUpdate().setEnabled(true);

		HandleCatalogView.getbtnAdd().setEnabled(true);

		HandleCatalogView.getbtnSet().setEnabled(true);


	}




}
